<template>
  <div>
    <mianbaoxie name1="权限管理" name2="权限列表"></mianbaoxie>
    <el-card>
      <el-table
        border
        stripe
        class="el-table"
        :data="rightList"
        style="width: 100%;margin-top: 10px;"
      >
        <el-table-column type="index" label="#"></el-table-column>
        <el-table-column prop="authName" label="权限说明"></el-table-column>
        <el-table-column prop="path" label="路径"></el-table-column>
        <el-table-column  label="等级">
          <template slot-scope="scoped">
            <div>
              <el-tag v-if="scoped.row.level == 0">一级</el-tag>
              <el-tag type="success" v-else-if="scoped.row.level == 1">二级</el-tag>
              <el-tag type="danger" v-else-if="scoped.row.level == 2">三级</el-tag>
            </div>
          </template>
        </el-table-column>
      </el-table>
    </el-card>
  </div>
</template>

<script>
import mianbaoxie from "@/compoents/mianbaoxie";

import { rights_list_req } from "@/api/rights.js";
export default {
  mounted(){
    this.getRightList();
  },
  data(){
    return{
      rightList:[],
    };
  },
  components: {
    mianbaoxie,
  },
  methods:{
    async getRightList(){
      const result = await rights_list_req({
        method:"get",
        url:"rights/list",

      });
      if(result.meta.status !== 200){
        return this.$message.error("获取列表失败");
      }
      this.rightList = result.data;
    },
  },
};
</script>

<style lang="scss" scoped>

</style>